package com.opennetexam.manager.sqlprovider;

import com.opennetexam.manager.dto.AdminInfo;
import com.opennetexam.manager.dto.ExamSiteAppViewModel;
import org.apache.log4j.Logger;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 奶茶
 * Created on 2017/11/8.
 */
public class ExamSiteAppViewModelProvider {

    private static Logger logger = Logger.getLogger(ExamSiteAppViewModelProvider.class);

    public String getCurrentSiteApp(Map<String,Object> parameter){
        String siteId = (String) parameter.get("siteId");
        StringBuilder stringBuffer = new StringBuilder("");
        stringBuffer.append("SELECT app.AppId,app.AppName,app.AppFTPUrl,app.AppUrl,site.ExamSiteID,site.SitePwd,site.ExamSiteCode,site.ExamSiteName FROM ExamAppSiteRelation AS re JOIN ExamApp AS app ON app.AppID = re.AppID JOIN ExamSite AS site ON site.ExamSiteID = re.ExamSiteID ");
        stringBuffer.append("WHERE re.IsCurrent = 1 LIMIT 1");
        //stringBuffer.append("WHERE re.ExamSiteID = \'");
        //stringBuffer.append(siteId);
        //stringBuffer.append("\' AND re.IsCurrent = 1 LIMIT 1");
        logger.info(stringBuffer.toString());
        return stringBuffer.toString();
    }

    public static void main(String[] args){
        ExamSiteAppViewModel examSiteAppViewModel = new ExamSiteAppViewModel();
        if(examSiteAppViewModel instanceof AdminInfo){
            System.out.println("123");
        }
    }
}
